package com.gollum.system.domain.model;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.gollum.jpa.domain.AbstractBaseEntity;
import com.gollum.jpa.domain.HertherBaseEnity;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.Table;
import java.util.Date;

/**
 * 操作日志
 * @author Herther
 * @version 1.0.0
 * @ClassName SysLog.java
 * @Description 实体
 * @createTime 2022年05月14日 15:54:00
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "sys_oper_log")
@EntityListeners(AuditingEntityListener.class)
public class SysOperLog extends AbstractBaseEntity {

    /**
     * 模块编码
     */
    @Column(name = "module_code",length = 20)
    private String moduleCode;

    /**
     * 模块标题
     */
    @Column(name = "module_title",length = 50)
    private String moduleTitle;

    /**
     * 操作类型  //参考这个类 com.gollum.common.enums.BusinessType
     */
    @Column(name = "business_type",length = 10)
    private String businessType;

    /**
     * 方法名称
     */
    @Column(name = "method")
    private String method;
    /**
     * 请求方式
     */
    @Column(name = "request_method",length = 10)
    private String requestMethod;

    /**
     * 操作类别（0其它 1后台用户 2手机端用户） com.gollum.common.enums.OperatorType
     */
    @Column(name = "operator_type",length = 10)
    private String operatorType;

    /**
     * 操作人员
     */
    @Column(name = "username",length = 30)
    private String username;

    /**
     * 部门名称
     */
    @Column(name = "dept_name",length = 100)
    private String deptName;

    /**
     * 请求URL
     */
    @Column(name = "request_url",length = 255)
    private String requestUrl;

    /**
     * 操作主机地址
     */
    @Column(name = "address_ip",length = 255)
    private String addressIp;

    /**
     * 操作地点
     */
    @Column(name = "location",length = 266)
    private String location;

    /**
     * 请求参数params
     */
    @Column(name = "request_params")
    private String requestParams;

    /**
     * 响应内容
     */
    @Column(name = "json_result",length = 2000)
    private String jsonResult;

    /**
     * 操作状态（0正常 1异常）
     */
    @Column(name = "status",length = 10)
    private String status;

    /**
     * 错误消息
     */
    @Column(name = "error_msg",length = 2000)
    private String errorMsg;

    /**
     * 操作时间
     */
    @DateTimeFormat(
            pattern = "yyyy-MM-dd HH:mm:ss"
    )
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(name = "operator_time")
    private Date operatorTime;

}